<template>
  <div style='height: 100%'>
   <Tabs v-model="tabKey" class="single-table-con">
      <TabPane label="数字化覆盖现状表" name="one">
         <cover vsCode='SHARE_145_2022_TABLE_CODE' v-if="tabKey == 'one'" pageType="1" title="《2022年数字化覆盖现状》"
         :downloadUrl="url('itShare', '/wfRptDgcalHrhxStatus/excelExport')"
         fromPage="creater"
         :$route='$route'
         type="status" :uploadUrl="url('itShare', '/wfRptDgcalHrhxStatus/excelImport/common')" ></cover>
      </TabPane>
      <TabPane label="数字化覆盖目标表" name="two">
         <cover vsCode='SHARE_145_PLAN_TABLE_CODE' v-if="tabKey == 'two'" pageType="2" title="《“十四五”数字化覆盖目标》"
          :downloadUrl="url('itShare', '/wfRptDgcalHrhx/excelExport')"
          :$route='$route'
          fromPage="creater"
          type="target" :uploadUrl="url('itShare', '/wfRptDgcalHrhx/excelImport/common')" ></cover>
      </TabPane>
      <TabPane  label="数字化覆盖率计算表" name="three">
         <cover vsCode='SHARE_145_COUNT_TABLE_CODE' v-if="tabKey == 'three'" pageType="3"
          :downloadUrl="url('itShare', '/wfRptDgCal/excelExport')"
          :$route='$route'
          fromPage="creater"
         title="《数字化覆盖率计算表》" type="rate" :uploadUrl="url('itShare', '/wfRptDgCal/excelImport')" ></cover>
      </TabPane>
    </Tabs>
  </div>
</template>

<script>
import cover from '@/components/ListView/cover2.vue'
import { approvalMix } from '@/views/todoCenter/myApproval/approval-mix'
import todoApi from '@api/todoCender'

export default {
  name: 'businessData',
    components:{
      cover
    },
    props: {
      '$route': {
        type: Object,
        default: () => ({})
      }
    },
    mixins: [approvalMix],
    data() {
      return {
        tabKey: 'one',
      }
   },
  created() {
    this.init()
  },
  methods: {
    init() {
      this.toRead()
    },
    toRead() {
      if (!this.$route || !this.$route.query) return
      const { Bid, Ldap, code } = this.$route.query
      if (Bid && Ldap && code) {
        todoApi.toRead({ Bid, Ldap, taskCode: code }).then(()=> {
        }).catch(err => {
          throw new Error(err)
        })
      }
    },
    url(type, pathname) {
        return window.RPConfig[type] + pathname;
      }
    }
}
</script>
<style lang="less" scoped>
.single-table-con {
    height: 100%;
    display: flex;
    flex-direction: column;
    /deep/.ivu-tabs-content {
      flex: 1;
    }
}
</style>
